package com.hdax.dm.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hdax.common.dto.IndexNavDto;
import com.hdax.dm.common.CommonResponse;
import com.hdax.dm.common.ResponseUtil;
import com.hdax.dm.entity.item.DmItemType;
import com.hdax.dm.mappers.DmItemTypeMapper;
import com.hdax.dm.mapstructs.IndexNavDtoMapper;
import com.hdax.dm.service.IndexNavService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class IndexNavServiceImpl extends ServiceImpl<DmItemTypeMapper, DmItemType> implements IndexNavService {

    @Autowired
    private DmItemTypeMapper dmItemTypeMapper;


    @Autowired
    private IndexNavDtoMapper indexNavDtoMapper;

    @Override
    public CommonResponse<List<IndexNavDto>> indexNavs() {
        List<DmItemType> dmItemTypes = dmItemTypeMapper.selectItemType();
        List<IndexNavDto> indexNavDtos = indexNavDtoMapper.toTargetList(dmItemTypes);
        CommonResponse commonResponse = ResponseUtil.returnSuccess(indexNavDtos);
        return commonResponse;
    }
}
